<form name="memberLoginForm" id="member-login-form" action="<?php echo $this->websiteUrl; ?>sys/login/member" method="post">
	<input type="hidden" id="page-to-redirect" name="pageToRedirect" value=""/>
	<p><label for="member-login-inp">{%Login%}</label><input id="member-login-inp" type="text" name="memberLoginName" value=""/></p>
	<p><label for="member-pass-inp">{%Password%}</label><input id="member-pass-inp" type="password" name="memberPassword" value=""/></p>
	<p><input id="member-submit-btn" type="submit" name="memberSubmit" value="{%Let me in%}"/></p>
	<p><a href="javascript:;" onclick="showHide('member-login-form', 'forgot-password-form');">Forgot password?</a></p>
</form>
<div id="msg"></div>
<form name="forgotPasswordForm" id="forgot-password-form" action="javascript:;" method="post" style="display: none;">
	<p><label for="member-email">{%Type your email%}:</label><input id="member-email" type="text" name="memberEmail" value=""/></p>
	<p><input id="member-recover-btn" type="submit" onclick="sendRecoveringLink()" name="memberRecoverSubmit" value="{%Let me remember%}"/></p>
	<p>&larr;&nbsp;<a href="javascript:;" onclick="showHide('forgot-password-form', 'member-login-form');">{%Go back%}</a></p>
</form>

<script type="text/javascript">
	$('#page-to-redirect').val(document.location);
	function showHide(idToHide, idToShow) {
		$('#' + idToHide).hide();
		$('#' + idToShow).show();
	}
	function sendRecoveringLink() {
		var websiteUrl = $('#hid-main-wsurl').val();
		var email = trimSpaces($('#member-email').val());
		if(email && checkMail(email)) {
			$('#msg').ajaxStart(function(){
				$(this).html('Sending mail...');
			})
			$.ajax({
				type: 'post',
				url: websiteUrl + 'sys/backend_ajax/sendrecoveringlink/',
				data: ({
					email : email
				}),
				success: function(response){
					$('#email').val('');
					switch (response) {
						case "success":
							$('#msg').html('The confirmation link was sent to your email. Check it out!');
						break;
						case "email does not exist":
							$('#msg').html('We don\'t know you, sorry.');
						break;
						case "error":
							$('#msg').html('Email address is not valid.');
						break;
					}
				}
			})
		}
	}
</script>